At present, a mainstream method for improving a system computing capability is using a multi-core system. A multi-core system including different types of processors is called as a heterogeneous system, which generally includes a general purpose processor and a special purpose accelerated processing unit. The heterogeneous system has the following advantages. On one hand, the general purpose processor processes scalar computation, and provides a general computing capability such that the heterogeneous system can adapt to applications of various aspects, on the other hand, the special purpose accelerated processing unit may provide powerful computing performance in some specific fields with high energy efficiency such that the heterogeneous system has higher performance and better effectiveness than a homogeneous system.
For the heterogeneous system, the most important problems occur in two aspects. The first is how to use the special purpose accelerated processing unit, and the second is how to achieve the highest overall computing performance of the system. The special purpose accelerated processing unit has a system architecture that is different from that of the general purpose processor, such as a traditional central processing unit (CPU). Therefore, an instruction set of the special purpose accelerated processing unit is incompatible with an instruction set of the traditional CPU. That is, code that runs on the CPU cannot directly run on the special purpose accelerated processing unit. Therefore, a CPU-specific development tool cannot be used to develop a special purpose accelerated processing unit. Nevertheless, to achieve the highest computing performance of the heterogeneous system, computing capabilities of all processors must be made the most of. Because of the great difference on functions and performance between processors, to make the most of computing capabilities of all processors, characteristics of all types of processors must be known in order to properly allocate tasks to the processors.
In a programming manner applied to the heterogeneous system and provided in the prior art, a developer needs to explicitly specify, in a program, on which type of processor a program fragment runs, that is, task allocation is completed by the developer. Open computing language (OpenCL) is a typical implementation of the solution, and provides an open framework standard for heterogeneous system programming. A developer may use a language provided by OpenCL to compile programs that run on processors. Then call an application programming interface (API) that is provided by OpenCL and used in a control system in order to specify which programs run on which types of processors, convert, by means of two-phase compilation, the programs into code that is executable on corresponding processors, and use the API of the control system to call the executable code to run on the corresponding processors.
It can be learned from the foregoing description that, using the programming manner applied to the heterogeneous system and provided in the prior art, a developer needs to solve the problem of system resource scheduling by himself/herself, which requires the developer to be familiar with hardware. In addition, because a scheduling solution is specified in advance and a device on which a program runs has already been specified, the system cannot perform proper scheduling according to a current state. Therefore, when a specified device is in a busy state, the program cannot run on other devices that are idle, which causes a waste of system resources.